package view.ui
{
	import events.MyEvent;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;

	public class HandleFolderBoard extends Sprite
	{
		private var addFolderBt:PngBt;
		private var pathView:PathStick;
		public function HandleFolderBoard()
		{
			super();
			init();
		}
		
		private function init():void
		{
			pathView=new PathStick();
			this.addChild(pathView);
			pathView.addEventListener("reChose",handleReBtClick);
			addFolderBt=new PngBt("handle");
			this.addChild(addFolderBt);
			showBt();
			addFolderBt.addEventListener(MouseEvent.CLICK,handleBtClick);
			this.addEventListener(Event.REMOVED_FROM_STAGE,handleRemovedFromStage);
		}
		
		private function handleReBtClick(e:MyEvent):void
		{
			this.dispatchEvent(new MyEvent("handleBt"));
		}
		
		private function handleBtClick(e:MouseEvent):void
		{
			this.dispatchEvent(new MyEvent("handleBt"));
		}
		
		
		public function set url(s:String):void
		{
			pathView.url=s;
		}
		
		public function showBt():void
		{
			addFolderBt.visible=true;
			pathView.visible=false;
		}
		
		public function showPath():void
		{
			addFolderBt.visible=false;
			pathView.visible=true;
		}
		
		private function handleRemovedFromStage(e:Event):void
		{
			pathView.removeEventListener("reChose",handleReBtClick);
			addFolderBt.removeEventListener(MouseEvent.CLICK,handleBtClick);
			this.removeEventListener(Event.REMOVED_FROM_STAGE,handleRemovedFromStage);
		}
	}
}